<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">申请领养人员</block>
		</cu-custom>

		<scroll-view scroll-y class="DrawerPage" :class="modalName=='viewModal'?'show':''">
			<view class="cu-card dynamic">
				<view class="cu-item shadow" v-for="(item,index) in info" :key="index">
					<view class="cu-list menu-avatar">
						<view class="cu-item">
							<view @click="toNav('/pages/info/index')" class="cu-avatar round lg" :style="{'background-image':'url('+ item.userinfo.avatar +')'}"></view>
							<view class="content flex-sub">
								<view>{{item.userinfo.nickname}}</view>
								<!-- <view class="text-gray text-sm flex justify-between">
									粉丝数量：29
								</view> -->
                                <view class="text-gray text-sm flex justify-between" @click="onPhone(item.userinfo.mobile)">
									电话号码:{{item.userinfo.mobile}}
								</view>
							</view>
							<!-- <view class="action text-red text-bold text-sm" style="position: relative;z-index: 999;" @tap="showModal"
							 data-target="viewModal">
								个人资料
							</view> -->
						</view>
						<view class="padding flex flex-direction" @click="onChoosepickup(item.pickup_id)">
							<button class="cu-btn bg-blue light xl">同意领养</button>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		
		<!-- 抽屉 -->
		<view class="DrawerClose" :class="modalName=='viewModal'?'show':''" @tap="hideModal">
			<text class="cuIcon-pullright"></text>
		</view>
		<scroll-view scroll-y class="DrawerWindow" :class="modalName=='viewModal'?'show':''">
			<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg">
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">姓名：张宣瓯</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">身份证：330381199090909090</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">手机号码：15077777777</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">微信：597045211</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">家人室友联系方式：15077777777</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">工作单位：美好去有限公司</text>
					</view>
				</view>
				<view class="cu-item">
					<view class="content">
						<text class="text-grey">职务：web前端</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
                info:'',
				modalName: null
			}
		},
		onHide() {
			console.log("hehe")
		},
		onLoad(option) {
		    this.post_id = option.post_id;
		},
        onShow() {
            this.getPost();
        },
		methods: {
			toNav(link) {
				uni.navigateTo({
					url: link
				})
			},
			showModal(e) {

				this.modalName = e.currentTarget.dataset.target;
			},
			hideModal(e) {
				this.modalName = null
			},
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			},
            onPhone(phone){
                uni.makePhoneCall({
                    phoneNumber:phone
                })
            },
            getPost() {
            
                this.loadModal = true;
                this.$http.post('getPost', {
                    post_id: this.post_id
                }).then(res => {
                    this.info = res.data.pickupList;
                    this.loadModal = false;
                }).fail(err => {
                    this.loadModal = false;
                })
            
            },
            onChoosepickup(pickup_id){
                this.$http.post('choosepickup',{
                    pickup_id:pickup_id
                }).then(res=>{
                    if(res.code == 1){
                        uni.showToast({
                            title:'操作成功'
                        })
                    }
                })
            }
		}
	}
</script>

<style lang="less" scoped>
	page {
		background-image: var(--gradualBlue);
		width: 100vw;
		overflow: hidden;
	}

	.DrawerPage {
		position: fixed;
		width: 100vw;
		height: 100vh;
		left: 0vw;
		background-color: #f1f1f1;
		transition: all 0.4s;
	}

	.DrawerPage.show {
		transform: scale(0.9, 0.9);
		left: 85vw;
		box-shadow: 0 0 60upx rgba(0, 0, 0, 0.2);
		transform-origin: 0;
	}

	.DrawerWindow {
		position: absolute;
		width: 85vw;
		height: 100vh;
		left: 0;
		top: 0;
		transform: scale(0.9, 0.9) translateX(-100%);
		opacity: 0;
		pointer-events: none;
		transition: all 0.4s;
		padding: 100upx 0;
	}

	.DrawerWindow.show {
		transform: scale(1, 1) translateX(0%);
		opacity: 1;
		pointer-events: all;
	}

	.DrawerClose {
		position: absolute;
		width: 40vw;
		height: 100vh;
		right: 0;
		top: 0;
		color: transparent;
		padding-bottom: 30upx;
		display: flex;
		align-items: flex-end;
		justify-content: center;
		background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));
		letter-spacing: 5px;
		font-size: 50upx;
		opacity: 0;
		pointer-events: none;
		transition: all 0.4s;
	}

	.DrawerClose.show {
		opacity: 1;
		pointer-events: all;
		width: 15vw;
		color: #fff;
	}

	.DrawerPage .cu-bar.tabbar .action button.cuIcon {
		width: 64upx;
		height: 64upx;
		line-height: 64upx;
		margin: 0;
		display: inline-block;
	}

	.DrawerPage .cu-bar.tabbar .action .cu-avatar {
		margin: 0;
	}

	.DrawerPage .nav {
		flex: 1;
	}

	.DrawerPage .nav .cu-item.cur {
		border-bottom: 0;
		position: relative;
	}

	.DrawerPage .nav .cu-item.cur::after {
		content: "";
		width: 10upx;
		height: 10upx;
		background-color: currentColor;
		position: absolute;
		bottom: 10upx;
		border-radius: 10upx;
		left: 0;
		right: 0;
		margin: auto;
	}

	.DrawerPage .cu-bar.tabbar .action {
		flex: initial;
	}
</style>
